package com.ds.lens.data.service.dao.sql.provider;

import com.ds.lens.data.service.dao.entity.LensMonitorTags;
import org.apache.ibatis.jdbc.SQL;

public class LensMonitorTagsSqlProvider {

    public String insertSelective(LensMonitorTags record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("lens_monitor_tags");

        if (record.getId() != null) {
            sql.VALUES("id", "#{id,jdbcType=BIGINT}");
        }

        if (record.getMonitorId() != null) {
            sql.VALUES("monitor_id", "#{monitorId,jdbcType=BIGINT}");
        }

        if (record.getApplicationId() != null) {
            sql.VALUES("application_id", "#{monitorId,jdbcType=BIGINT}");
        }

        if (record.getContent() != null) {
            sql.VALUES("content", "#{content,jdbcType=VARCHAR}");
        }

        return sql.toString();
    }

    public String updateByPrimaryKeySelective(LensMonitorTags record) {
        SQL sql = new SQL();
        sql.UPDATE("lens_monitor_tags");

        if (record.getMonitorId() != null) {
            sql.SET("monitor_id = #{monitorId,jdbcType=BIGINT}");
        }

        if (record.getMonitorId() != null) {
            sql.SET("application_id = #{applicationId,jdbcType=BIGINT}");
        }

        if (record.getContent() != null) {
            sql.SET("content = #{content,jdbcType=VARCHAR}");
        }

        sql.WHERE("id = #{id,jdbcType=BIGINT}");

        return sql.toString();
    }
}
